package com.itheima.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/*
构建分页拦截器
 */
@Configuration
public class MybatisPlusConfig {

    @Bean
    public MybatisPlusInterceptor mpi(){
        //1.构建mybatisPlus 拦截器集合
        MybatisPlusInterceptor mpi = new MybatisPlusInterceptor();

        //2.追加分页拦截器 PaginationInnerInterceptor/分页拦截器
        mpi.addInnerInterceptor(new PaginationInnerInterceptor());

        //3.返回分页拦截器集合
        return mpi;
    }
}
